package com.zjj.lbw.microservice.rpc.feign.feignprovider.controller;

import com.zjj.lbw.common.bean.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhanglei.zjj
 * @description 微服务-rpc-测试feign生产者
 * @date 2023/7/6 22:03
 */

@RestController
@RequestMapping("/order")
@Slf4j
public class OrderController {
    /**
     * 根据用户id查询订单信息
     *
     * @param userId
     * @return
     */
    @RequestMapping("/findOrderByUserId/{userId}")
    public R findOrderByUserId(@PathVariable("userId") Integer userId) throws InterruptedException {
        // 模拟超时
        Thread.sleep(4000);

        log.info("根据userId:" + userId + "查询订单信息");

        return R.ok().put("orders", userId + ", orderId = no.34413349900011111");
    }
}
